<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ClarifyLocations.aspx.cs" Inherits="ClarifyLocations" Title="Clarify Locations - gatsb" %>
<%@ Register Src="~/GatsbMap.ascx" TagName="GatsbMap" TagPrefix="decavuc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeaderPlaceholder" Runat="Server">
    <link rel="stylesheet" type="text/css" href="Styles/ClarifyLocationsStyle.css" />
    <script language="javascript" type="text/javascript">
        // <!--
        function Page_Loaded()
        {
            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(AsyncPageLoad_Completed);
        }
        
        function AsyncPageLoad_Completed()
        {
        
            if (document.getElementById("<%= curLocationMapHolder.ClientID %>") != null)
            {
                <%= curLocationMap.StartFunctionName %>(); 
                eval(document.getElementById("pushpinJs").innerText);
            }
        }
        
        function CenterMap(lati, longi)
        {
            <%= curLocationMap.MapName %>.SetCenter(new VELatLong(lati, longi));
        }
        
        function SetLocationSelected_Click(id, selectedItem)
        {
            var items = document.getElementById("locationsFound");
            for(var i = 0; i < items.childNodes.length; i++)
            {
                var curItem = items.childNodes[i];
                curItem.style.backgroundColor = "#FFFFFF";
                curItem.style.color = "black";
            }
            
            selectedItem.style.backgroundColor = "#E2E8F3";
            document.getElementById("<%= locationSelectedHidden.ClientID %>").value = id;
        }
        
        function ShowHideLocationText(hide)
        {
            var para = document.getElementById("<%= enterLocationPara.ClientID %>");
            if (hide == true || hide == "selected")
            {
                para.style.display = "none";
            }
            else
            {
                para.style.display = "block";
            }
        }
        // -->
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageBodyPlaceholder" Runat="Server">
    <div style="margin-left:50px;margin-right:50px">
        <h1 style="margin-bottom:15px;">We need to know a little more about...</h1>
        
        
<asp:UpdatePanel runat="server" ID="wizUpdate" ChildrenAsTriggers="true">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="mainPages" EventName="NextButtonClick" />
        <asp:AsyncPostBackTrigger ControlID="placesList" EventName="ItemCommand" />
    </Triggers>
    <ContentTemplate>
        <div class="ColumnLeft">
            <asp:Repeater runat="server" ID="placesList" OnItemCommand="PlacesList_ItemCommand">
                <HeaderTemplate>
                    <ul class="PlacesList">
                </HeaderTemplate>
                <ItemTemplate>
                    <li>
                        <img src="<%# GetLocationImage((Decav.Gatsb.Location)Container.DataItem) %>" alt="" />
                        <asp:LinkButton runat="server"
                        CommandArgument="<%# ((Decav.Gatsb.Location)Container.DataItem).Id %>"
                        ><%# ((Decav.Gatsb.Location)Container.DataItem).Name %></asp:LinkButton>
                        <div style="clear:both"></div>
                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    </ul>
                </FooterTemplate>
            </asp:Repeater>
        </div>
        <div class="ColumnMain">
            <asp:Wizard runat="server" ID="mainPages" OnFinishButtonClick="mainPages_FinishButtonClick" OnNextButtonClick="mainPages_NextButtonClick">
                <SideBarStyle CssClass="WizardSideBar" />
                <WizardSteps>
                <asp:WizardStep StepType="Start" ID="gatherInfoStep">
                    
                    <h3><%= CurrentLocation.Name %> - Information</h3>
                    <div class="ErrorRibbon" id="errorRibbonDiv" runat="server" visible="false"></div>
                    <div class="StatusRibbon" id="locationFinishedInfo" runat="server" visible="false">
                        You have already finished entering information for <%= CurrentLocation.Name %>.<br />
                        If you wish to change the information you entered, you may resubmit this form.
                    </div>
                    <p>
                        Tell us a bit more about <b><%= CurrentLocation.Name %></b>.  Please try to correct
                        and <b>spelling</b> and <b>capitalization</b> so it looks right when other users
                        see it.
                    </p>
                    <div class="StyledForm">
                        <p>
                            <label for="<%= nameTextBox.ClientID %>">Name</label>
                            <asp:TextBox runat="server" ID="nameTextBox" />
                        </p>
                        <p>
                            <label for="<%= typeDropDown.ClientID %>">Is...</label>
                            <asp:DropDownList runat="server" ID="typeDropDown">
                                <asp:ListItem Value="Bar">a bar or club</asp:ListItem>
                                <asp:ListItem Value="Restaurant">a restaurant</asp:ListItem>
                                <asp:ListItem Value="Cafe">a cafe</asp:ListItem>
                                <asp:ListItem Value="ParkOutdoors">a park</asp:ListItem>
                                <asp:ListItem Value="Store">a store</asp:ListItem>
                                <asp:ListItem Value="Home">my home</asp:ListItem>
                                <asp:ListItem Value="Office">my office</asp:ListItem>
                                <asp:ListItem Value="CrossStreets">an intersection</asp:ListItem>
                                <asp:ListItem Value="StreetAddress">an address</asp:ListItem>
                                <asp:ListItem Value="Unknown">something else (other)</asp:ListItem>
                            </asp:DropDownList>
                        </p>
                        <p class="NewSection">
                            <label for="<%=localeDropDown.ClientID %>">City</label>
                            <asp:DropDownList runat="server" ID="localeDropDown">
                                <asp:ListItem>New York</asp:ListItem>
                            </asp:DropDownList>
                        </p>
                        <p class="NoFormat">
                            <asp:CheckBox runat="server" ID="noMappedLocationCheck" Text="This place cannot be mapped" />
                        </p>
                        <p id="enterLocationPara" runat="server">
                            <label for="<%= locationTextBox.ClientID %>">Location</label>
                            <asp:TextBox runat="server" ID="locationTextBox" /><br />
                            <span style="font-style:italic;color:#666666">Enter an address or intersection</span>
                        </p>
                    </div>
                </asp:WizardStep>
                <asp:WizardStep StepType="Step" ID="selectLocationStep">
                    <h3><%= CurrentLocation.Name %> - Locations</h3>
                    <p>
                        Select the location for <b><%= nameTextBox.Text %></b> and then click
                        the "next" button.
                    </p>
                    <div class="ErrorRibbon" runat="server" id="selectLocationErrorDiv" visible="false"></div>
                    <div class="StatusRibbon" runat="server" id="didYouMeanDiv" visible="false">
                        <asp:LinkButton runat="server" ID="didYouMeanLink" OnClick="DidYouMeanLink_Click"></asp:LinkButton>
                    </div>
                    <div>
                        <asp:Repeater runat="server" ID="locationsFoundRepeater">
                            <HeaderTemplate><ul class="SearchResults" id="locationsFound"></HeaderTemplate>
                            <ItemTemplate><li
                               onclick="<%# System.String.Format("SetLocationSelected_Click('{0}', this);{1}", ((Decav.Gatsb.Location)Container.DataItem).Id, GetLocationJavascript((Decav.Gatsb.Location)Container.DataItem)) %>">
                                    <a href="#" onclick="<%# GetLocationJavascript((Decav.Gatsb.Location)Container.DataItem)  %>" class="Label"><img
                                    src="<%# System.String.Format("Images/Pushpins/{0}.gif", GetLocationPushpinIndex(((Decav.Gatsb.Location)Container.DataItem))) %>" alt="" /></a>
                                    
                                    <div style="float:right;"><a href="#" onclick="return false;">Select this location</a></div>
                                    <%# Container.DataItem.ToString() %>
                                    <div style="clear:both"></div>
                                </li></ItemTemplate>
                            <FooterTemplate></ul></FooterTemplate>
                        </asp:Repeater>
                        <asp:HiddenField runat="server" ID="locationSelectedHidden" />
                    </div>
                    <div runat="server" id="curLocationMapHolder">
                        <decavuc:GatsbMap runat="server" id="curLocationMap" CssClass="PlaceMap" />
                        <div id="pushpinJs" style="display:none;"><%= curLocationMap.CreatePushpinJavascript() %></div>
                    </div>
                </asp:WizardStep>
                <asp:WizardStep runat="server" ID="finishedStep" StepType="finish">
                    <h3>
                        Thank you for submitting <%= CurrentLocation.Name %> to Gatsb.
                    </h3>
                    <p>
                        If there are any more grey pushpins on the left, select them to update
                        the locations of those as well.
                    </p>
                </asp:WizardStep>
                </WizardSteps>
            </asp:Wizard>
    </div>
    </ContentTemplate>
</asp:UpdatePanel>
    </div>
</asp:Content>
